﻿function pageLoad(sender, args)
{
     $addHandler($get("btnSave"),"click",SavePwd);
}
//保存我的密码
function SavePwd()
{
var vlid=true;
$get("btnSave").disabled = true;
showProgressBar(true);
 $get("SPassword1").style.display='none';
$get("SPassword3").style.display='none';
$get("SPassword4").style.display='none';
 if($get("Password4").value.length<6)
 {
    vlid=false;
    $get("SPassword4").style.display='';
 }
 if($get("Password3").value.length<6)
 {
    vlid=false;
    $get("SPassword3").style.display='';
 }
 if($get("Password1").value.length<6)
 {
    vlid=false;
    $get("SPassword1").style.display='';
     $get("SPassword1").innerHTML="<br />"+error1;
 }else if($get("Password1").value!=$get("Password4").value)
 {
  vlid=false;
  $get("SPassword1").style.display='';
    $get("SPassword1").innerHTML="<br />"+error;
 }
 if(!vlid){
showProgressBar(false);
$get("btnSave").disabled = false;
 return;}
$get("btnSave").disabled=true;
             showProgressBar(true);
var pwd=$get("Password1").value;
var oldPwd=$get("Password3").value
WebServices.My.UpdatePwd( MemberNo, pwd, oldPwd,onsucc); 
}
function onsucc(result)
 {
     

     if(result[0])
     { 
        if(result[1])
       {
      $get("MessagesBox").style.display='';
      $get("MessageImg").src = MessageImageS;
        $get("MessageText").innerHTML = MessageTextS;
   }
   else
   {
   $get("MessagesBox").style.display='';
     $get("MessageImg").src = MessageImageF;
        $get("MessageText").innerHTML = MessageTextF;
       
       }
     } 
     else
     {
         $get("MessagesBox").style.display='';
      $get("MessageImg").src = MessageImageS;
        $get("MessageText").innerHTML = MessageTextF;
     }
   document.getElementById('Password1').value="";
       document.getElementById('Password3').value="";
       document.getElementById('Password4').value="";
  $get("btnSave").disabled=false;
             showProgressBar(false);
   
 }
